//
//  cardtest1.c
//  tests outpost card with random inputs
//
//  Created by Preston Skaggs on 1/25/14.
//
//

#include <stdio.h>
#include <stdlib.h>
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <math.h>
#include <assert.h>

#define CARD_FUNCTION 1
#define NUM_TESTS 100

int main(){
    SelectStream(2);
    PlantSeeds(3);
    struct gameState *state = malloc(sizeof(struct gameState));
    assert(state != 0);
    int i, n, player, numPlayers, test, handPos;
    int bonus = 1;
    enum CARD card = outpost;
    if(CARD_FUNCTION == 0){
        for(n=0; n<=NUM_TESTS; n++){
            
            for(i=0; i<sizeof(struct gameState); i++){
                ((char*)state)[i] = floor(Random()*256);
            }
            numPlayers = floor(Random()*2);
            state->numPlayers = numPlayers;
            player = (Random()*numPlayers)+1;
            state->deckCount[player] = floor(Random() * MAX_DECK);
            state->discardCount[player] = floor(Random() * MAX_DECK);
            state->handCount[player] = floor(Random() * MAX_HAND);
            handPos = (Random()*MAX_HAND);
            test = outpostCard(player, handPos, state);
            assert(test == 0);
        }
        printf("Tests OK\n");
        
    }
    else{
        for(n=0; n<=NUM_TESTS; n++){
            
            for(i=0; i<sizeof(struct gameState); i++){
                ((char*)state)[i] = floor(Random()*256);
            }
            numPlayers = floor(Random()*4);
            state->numPlayers = numPlayers;
            player = (Random()*numPlayers )+1;
            handPos = (Random()*MAX_HAND);
            cardEffect(card, 0, 1, 2, state, handPos, &bonus);
        }
    }
    printf("Tests OK\n");
        return 0;
}